package com.example.ssm.controller;

import com.example.ssm.bean.CommonResult;
import com.example.ssm.bean.Department;
import com.example.ssm.dao.DepartmentMapper;
import com.example.ssm.service.DepartmentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Intellij IDEA.
 * User: JonnyJiang
 * Date: 2021/6/7
 */
@Controller
public class DepartmentController {

    @Resource
    DepartmentService departmentService;

    @RequestMapping("/dep")
    @ResponseBody
    public CommonResult getDep(){
        List<Department> departments = departmentService.getDep();
        return new CommonResult(200,"ok").add("dep",departments);
    }
}
